import pandas as pd

#读入需要归一的字段
data = pd.read_excel("D:/Project/Test/norm_local_test/diabetes/basic_infomation/njzdyy_sys.xlsx", header=None)
data["result"] = 0

#读入归一的测试字典
data_dict = pd.read_table(r"D:\Project\Test\norm_test\diabetes_classification\dict.txt", header=None)
data_dict["norm_name"] = 0
data_dict["re_name"] = 0
for i in range(len(data_dict)):
    data_dict.loc[i, "norm_name"] = data_dict.iloc[i, 0].split(",")[0]
    data_dict.loc[i, "re_name"] = data_dict.iloc[i, 0].split(",")[1]

#本地测试
import re
for i in range(len(data)):
    for j in range(len(data_dict)):
        flag = re.search(data_dict.loc[j, "re_name"], data.iloc[i, 0])
        if flag != None:
            data.loc[i, "result"] = data_dict.loc[j, "norm_name"]
            break

# data.to_excel(r"D:\Downloads\cleaned_dept.xlsx", index=None)